package net.ojbk.study.twobox.dao;

import net.ojbk.study.twobox.beans.po.Department;
import net.ojbk.study.twobox.beans.vo.SelectOption;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import javax.validation.constraints.Min;
import java.util.List;

public interface DepartmentMapper extends Mapper<Department> {
    @Select("SELECT COUNT(*) FROM crm_department, crm_post, crm_staff WHERE crm_department.id=crm_post.depID AND crm_post.id=postID AND crm_department.id = #{id}")
    public int getCountByKey(int id);

    @Select("SELECT * FROM crm_department WHERE isCancel != 1")
    public List<Department> getAll();

    @Select("SELECT id id, depName `name` FROM crm_department")
    public List<SelectOption> getAllDepartmentName();
}